﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WPFServices.Models
{
    public class ApiResult
    {
        public bool IsSuc { get; set; }
        public ResultCode code { get; set; }
        public string msg { get; set; }

        public ApiResult() { }

        public ApiResult(bool IsSuc, ResultCode code, string msg)
        {
            this.IsSuc = IsSuc;
            this.code = code;
            this.msg = msg;
        }
    }

    public class ApiResult<T> : ApiResult
    {
        public T data { get; set; }

        public ApiResult() { }

        public ApiResult(bool IsSuc, ResultCode code, string msg, T data) : base(IsSuc, code, msg)
        {
            this.data = data;
        }
    }

    public enum ResultCode
    {
        Ok = 200,
        Fail = 500
    }

    /// <summary>
    /// 分页
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class ApiPaging<T>
    {
        public int TotalCount { get; set; }
        public int TotalPage { get; set; }
        public T Data { get; set; }
    }

    /// <summary>
    /// 分页模型基类
    /// </summary>
    public class PageModel
    {
        public int PageIndex { get; set; } = 1;
        public int PageSize { get; set; } = 10;
    }
}
